package com.siqiaoren.service.impl;

import com.siqiaoren.dao.UserDao;
import com.siqiaoren.domain.User;
import com.siqiaoren.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    public boolean save(User user) {
        return userDao.save(user) > 0;
    }
    public boolean delete(Integer id){
        return userDao.delete(id) > 0;
    }

    public User getByName(String username) {
        return userDao.getByName(username);
    }

    public boolean checkNamePassword(String username, String password){
        return userDao.checkNamePassword(username, password) > 0;
    }


    public List<User> getAll() {
        return userDao.getAll();
    }
}
